package leetcode_2501_2600;

import java.util.HashSet;
import java.util.Set;

public class LeeCode_2559 {
    public static void main(String[] args) {

    }
    private static int[] vowelStrings(String[] words, int[][] queries) {
        Set<Character> set = new HashSet<>();
        set.add('a');
        set.add('e');
        set.add('i');
        set.add('o');
        set.add('u');
        int m = queries.length, n = words.length;
        int[] ans = new int[m];
        int[] sums= new int[n + 1];
        for (int i = 1; i <= n; i++) {
            String word = words[i - 1];
            if (set.contains(word.charAt(0)) && set.contains(word.charAt(word.length() - 1))){
                sums[i] = sums[i - 1] + 1;
            }else {
                sums[i] = sums[i - 1];
            }
        }
        for (int i = 0; i < m; i++) {
            int[] q = queries[i];
            ans[i] = sums[q[1] + 1] - sums[q[0]];
        }
        return ans;
    }
}
